package com.tidc.match.rabbit.service;

import com.tidc.match.rabbit.dto.ParamReq;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;


@Service
public class PomitTopicMessageService {
	@Value("${rabbit.topic.exchange}")
	private String rabbitTopicExchange;

	@Value("${rabbit.direct.key}")
	private String rabbitDirectKey;

	@Value("${rabbit.topic.key}")
	private String rabbitTopicKey;

	@Autowired
	AmqpTemplate amqpTemplateTopic;

	public void sendMessage(ParamReq paramReq){
//		路由键是spring.key.direct
		amqpTemplateTopic.convertAndSend(rabbitTopicExchange, rabbitDirectKey, paramReq);
	}

	public void sendMessage2(ParamReq paramReq){
//		spring.key.topic
		amqpTemplateTopic.convertAndSend(rabbitTopicExchange, rabbitTopicKey, paramReq);
	}
}
